package com.platform.car.controller;

import com.platform.car.model.Cars;
import com.platform.car.service.CarsService;
import com.platform.common.page.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/car/cars")
public class CarsController {

    @Autowired
    CarsService carsService;

    /**
     * 车辆列表，带分页
     * @param page
     * @param cars
     * @param modelMap
     * @return
     */
    @RequestMapping(value = "/list")
    public String list(Page<Cars> page, Cars cars, ModelMap modelMap){
        Page<Cars> carsList = carsService.findByPage(page,cars);
        modelMap.addAttribute("carsList",carsList);
        return  "/car/cars/list.jsp";
    }
}
